package com.example.test.advice.第九章_多线程和并发.建议123_Voliate不能保证数据同步;

import com.sun.org.apache.regexp.internal.RE;

public class UnsafeThread implements Runnable{
    //共享资源
    private volatile int count = 0;

    @Override
    public void run() {
        //增加cpu的繁忙程度，不用关心其逻辑含义
        for (int i= 0;i<1000;i++){
            Math.hypot(Math.pow(92456789,i),Math.cos(i));

        }
        //自增运算
        count ++;
    }

    public int getCount(){

        return count;
    }
}
